package com.studyyoun.android.nonghe.home.activity;
/**
 * Created by zhaolong on 2017/10/5.
 * 站在顶峰，看世界
 * 落在谷底，思人生
 */

import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.studyyoun.android.androidcommonbaselibrary.activity.CommonBaseActivity;
import com.studyyoun.android.androidcommonbaselibrary.utils.AnimationUtils;
import com.studyyoun.android.nonghe.R;
import com.studyyoun.android.nonghe.welcom.CommonUserHelper;
import com.studyyoun.android.nonghe.welcom.model.UserModel;

/**
 * class infation
 */
public class SettingActivity extends CommonBaseActivity {
    private View mBackLinearLayout;
    private TextView mHeaderTitleTextView;
    private LinearLayout mExitLoginLinearLayout;
    private LinearLayout mAboutMeLinearLayout;
    private View mAboutMeDiviView;
    private LinearLayout mUpdateLinearLayout;
    private View mUpdateDiviView;

    @Override
    protected void getAllIntentExtraDatas(Intent intent) {

    }

    @Override
    protected int getCommonLayoutId() {
        return R.layout.activity_setting_layout;
    }

    @Override
    protected void commonInitView(View view) {
        mBackLinearLayout = findViewById(R.id.ll_base_back);
        mHeaderTitleTextView = findViewById(R.id.tv_base_header_title);
        mExitLoginLinearLayout = findViewById(R.id.ll_set_exit_login);
        mExitLoginLinearLayout.setVisibility(View.GONE);

        mAboutMeLinearLayout = findViewById(R.id.ll_set_about_me);
        mAboutMeLinearLayout.setVisibility(View.INVISIBLE);
        mAboutMeDiviView = findViewById(R.id.v_set_about_me_divi);
        mAboutMeDiviView.setVisibility(View.INVISIBLE);

        //版本更新
        mUpdateLinearLayout = findViewById(R.id.ll_set_update);
        mUpdateLinearLayout.setVisibility(View.INVISIBLE);
        mUpdateDiviView = findViewById(R.id.v_set_update_divi);
        mUpdateDiviView.setVisibility(View.INVISIBLE);
    }


    @Override
    protected void commonFunction() {

    }

    @Override
    protected void commonDelayFunction() {
        mHeaderTitleTextView.setText("设置中心");
        mBackLinearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SettingActivity.this.finish();
            }
        });

        AnimationUtils.initLeftToRightAnimationFunction(mAboutMeLinearLayout,600,100);
        AnimationUtils.initRightToLeftAnimationFunction(mAboutMeDiviView,600,200);
        AnimationUtils.initLeftToRightAnimationFunction(mUpdateLinearLayout,600,100);
        AnimationUtils.initRightToLeftAnimationFunction(mUpdateDiviView,600,200);
        UserModel userModel = CommonUserHelper.getUserModel();
        if (userModel != null) {
            AnimationUtils.initLeftToRightAnimationFunction(mExitLoginLinearLayout,600,200);
            mExitLoginLinearLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    CommonUserHelper.exitUser();
                    finish();
                }
            });
        }

        mUpdateLinearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(SettingActivity.this,AppVersonActivity.class));
            }
        });

        mAboutMeLinearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(SettingActivity.this,AboutMeActivity.class));
            }
        });
    }


}
